﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Quartz.Net.DAL;
using Quartz.Net.Model;

namespace Quartz.Net.BLL
{
    public class Task_Quartz_JobtriggerBLL
    {
        Task_Quartz_JobtriggerDAL dal = new Task_Quartz_JobtriggerDAL();
        /// <summary>
        /// 插入任务表数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int InsertJob(Task_Quartz_JobTriggerModel model)
        {
            return dal.InsertJob(model);
        }
        /// <summary>
        /// 更新任务
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int UpdateJob(Task_Quartz_JobTriggerModel model)
        {
            return dal.UpdateJob(model);
        }
        /// <summary>
        /// 获取当前有效的任务
        /// </summary>
        /// <returns></returns>
        public IEnumerable<Task_Quartz_JobTriggerModel> GetInfo()
        {
            return dal.GetInfo();
        }
        /// <summary>
        /// 获取单个任务数据
        /// </summary>
        /// <param name="nguid"></param>
        /// <returns></returns>
        public IEnumerable<Task_Quartz_JobTriggerModel> GetOneInfo(string nguid)
        {
            return dal.GetOneInfo(nguid);
        }
        /// <summary>
        /// 获取最大序号
        /// </summary>
        /// <returns></returns>
        public int MaxXh()
        {
            return dal.MaxXh();
        }
        /// <summary>
        /// 更新valid字段
        /// </summary>
        /// <param name="nguid"></param>
        /// <param name="valid">是否有效 0:无效 1：有效</param>
        /// <returns></returns>
        public int UpdateValid(string nguid, string valid)
        {
            return dal.UpdateValid(nguid, valid);
        }
        /// <summary>
        /// 更新运行状态
        /// </summary>
        /// <param name="nguid"></param>
        /// <param name="RunStatus">1：正在运行中 2：等待下次运行 3：暂停中</param>
        /// <returns></returns>
        public int UpdateRunStatus(string nguid, RunStatus RunStatus)
        {
            return dal.UpdateRunStatus(nguid, ((int)RunStatus).ToString());
        }
         /// <summary>
         /// 更新是否变更
         /// </summary>
         /// <param name="nguid"></param>
         /// <param name="ISChange">1：发生变化 0：未发生变化</param>
         /// <returns></returns>
         public int UpdateISChange(string nguid, string ISChange)
         {
             return dal.UpdateISChange(nguid, ISChange);
         }
    }
}
